<meta charset="utf-8"/>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/index.js"></script>
		<script src="../../js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript">
            
        mui.plusReady(function() { 
        	//定位获取
			getPosBaidu();
			//alert(getPosBaidu());
//			alert(123456);
//			alert(lat);
//			alert(longt);
        	// 隐藏滚动条
            plus.webview.currentWebview().setStyle({scrollIndicator:'none'});
		    //图片轮播，获得slider插件对象
            var gallery = mui('.mui-slider');
            gallery.slider({
                interval:5000//自动轮播周期，若为0则不自动播放，默认为0；
            });
            
          var list = document.getElementsByClassName('mui-table-view-cell');
		  for(var i = 0;i<list.length;i++){
		  	list[i].addEventListener('tap', function() {
               mui.openWindow({
                   url: 'courseDetail.html', 
                   id:'courseDetail',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
               });
		    });
		  }
		  
            //进入首页面
            document.getElementById('indexTab').addEventListener('tap', function() {
                mui.openWindow({
                    url: '../../index.html', 
                    id:'index',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
                });
            }); 
            //进入社区页面
            document.getElementById('communityTab').addEventListener('tap', function() {
            	mui.openWindow({
                        url: '../../community.html', 
                        id:'community',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
                   });
            	/*var userinfo = plus.storage.getItem('userinfo');
            	if (userinfo != '' && userinfo != null) {
            		mui.openWindow({
                        url: '../../community.html', 
                        id:'community',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
                   }); 
            	} else{
            		mui.openWindow({
                        url: '../../login.html', 
                        id:'login',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
                    });
            	}*/
                
            }); 
            
            //进入个人中心页面
            document.getElementById('dataTab').addEventListener('tap', function() {
            	var userinfo = plus.storage.getItem('userinfo');
            	if (userinfo != '' && userinfo != null) {
	                mui.openWindow({
	                    url: '../../data.html', 
	                    id:'data',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
	                });
            	} else{
            		mui.openWindow({
                        url: '../../login.html', 
                        id:'login',
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
                    });
            	}
            });

                });
                
function geoInf( position ) {
	var str = "";
//	var timeflag = position.timestamp;//获取到地理位置信息的时间戳；一个毫秒数；
//	str += "时间戳："+timeflag+"\n";
	var codns = position.coords;//获取地理坐标信息；
	var lat = codns.latitude;//获取到当前位置的纬度；
	str += "纬度："+lat+"\n";
	var longt = codns.longitude;//获取到当前位置的经度
	str += "经度："+longt+"\n";
			  
        	var self = plus.webview.currentWebview();
      		var type= self.type;
      		var search= self.search;
      		if(type==undefined){
      			type = '';
      		}
      		if(search==undefined){
      			search = '';
      		}
      		var str= "";
			rr(type,lat,longt,str,search);
        $(".select a").click(function(){
        	var stri = $(this).html();
        	if(stri == "人气最高"){
        		
        	}else{
        		stri = "";
        	}
            	rr(type,lat,longt,stri,search);
                $(this).addClass("active");
                $(this).parent().siblings().find("a").removeClass("active");
            });
}
                
function rr(type,lat,longt,str,search){
	             mui.ajax({ //ajax请求
					url: getServerIp + 'AppCourse/courseList',
					type: 'GET',
					data: {    
                        id:type,lat:lat,longt:longt,renqi:str,search:search
					}, //传参
					success: function(data, textStatus, jqXHR) {
						document.getElementById('csaa').innerHTML = "";
						var table = document.body.querySelector('#csaa');
					//	var obj = JSON.parse(data);
					var list =  data.courseList;
					if(list==null || list ==""){
						var li = document.createElement('li');
						li.innerHTML = "暂无数据"
						table.appendChild(li);
					}else{
						for(var i = 0;i<list.length;i++){
						   var obj = list[i];
	    					var li = document.createElement('li');
	    					
	    						li.id=obj.id;
	    						li.title=obj.course_name;
								li.className = 'mui-table-view-cell mui-media';
								li.innerHTML = '<a class="mui-navigate-right">'+
							'<img style="width:100px;height:80px;" class="mui-media-object mui-pull-left" src="'+getServerIp+'/Public/Uploads/image/'+obj.image+'">'+
							'<div class="mui-media-body">'+
								obj.course_name;
								
								if (obj.authentication == "已认证") {
								    li.innerHTML += '<span><img style="height: 20px;" src="../../images/atta.png" /></span>';
								}else{
									li.innerHTML += '<div style="height: 20px;"></div>';
								}
										//obj.comment_count=strempty(obj.comment_count);
										//obj.collection_count=strempty(obj.collection_count);
								li.innerHTML +='<div style="padding-bottom: 10px;bottom: 0;">'+
								    '<p class="mui-ellipsis" style="float: left;">收藏&nbsp;' + obj.collection_count + '&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;' + obj.comment_count + '</p>'+
								    '<p style="float: right;">'+obj.temp_distance+'km</p>'+
								'</div>'+
							'</div>'+
						'</a>'
						'</a>';
						
	                        table.appendChild(li);
	                        
						}
					}
					//打开课程详情页
					var ls = document.getElementsByClassName('mui-table-view-cell');
							for (var i = 0; i < ls.length; i++) {
								var obj = ls[i];
								obj.addEventListener('tap', function() {
									mui.openWindow({
										url: 'courseDetail.html', 
                                        id:'courseDetail',
                                        extras:{
                                        	type:this.getAttribute("id"),title:this.getAttribute("title")
                                        },
	                     waiting:{
                            autoShow:false,//自动显示等待框，默认为true
                          }
									})
								})
							}
					}
				})
}
        </script>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.mui-bar-nav~.mui-content {
				padding: 0;
			}
			.title {
				margin: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
			}
			
			.nav{
				height:35px;
				border-bottom: 1px solid lightgrey;
				background: white;
			}
			.nav ul{
				list-style:none;
				padding: 0;
				margin-left: 0;
			}
			.nav ul li{
				float:left;
				width:33%;
				padding-left:0;
				margin-left:0;
				/*margin-top: 5px;*/
				text-align: center;
			}
			.nav ul li a{
				color: black;
			}
			.nav ul .select a:hover{
				color: #83e5ab;
			}
			.cur{
				color:darkcyan;
			}
		</style>
 
  
		<div class="nav" style="position: fixed;width: 100%;height: 40px;top:0px;z-index: 99;">  
		    <ul >       
			    <li class="select" style="border-right: 1px solid #DDDDDD;"><a class="active">全部</a></li>
			    <li class="select" style="border-right: 1px solid #DDDDDD;"><a class="">距离最近</a></li>
			    <li class="select" style=""><a class="">人气最高</a></li>
		    </ul>
	    </div>
 
<div class="mui-content" style="top:30px;position: absolute;width: 100%;">
			<ul class="mui-table-view mui-table-view-chevron" style="margin-bottom: 50px;" id="csaa">
				<!--<li class="mui-table-view-cell mui-media" id="courseDetail">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<span><img style="height: 20px;" src="../../images/atta.png" /></span>
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;30&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;16</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							小东家舞蹈班
							<span><img style="height: 20px;" src="../../images/atta.png" /></span>
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;31&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;156</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							佳佳艺术体操
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;200&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;506</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<span><img style="height: 20px;" src="../../images/atta.png" /></span>
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;221&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;526</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;43.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							优肯体育篮球班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.8km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							星星书法班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a class="mui-navigate-right">
						<img class="mui-media-object mui-pull-left" src="../../images/cbd.jpg">
						<div class="mui-media-body">
							南京JM Dance专业拉丁舞基础班
							<div style="padding-bottom: 10px;bottom: 0;position: absolute;">
							    <p class='mui-ellipsis' style="float: left;">收藏&nbsp;20&nbsp;&nbsp;&nbsp;&nbsp;评价&nbsp;56</p>
							    <p style="float: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2km</p>
							</div>
						</div>
					</a>
				</li>-->
			</ul>
</div>

		
		<nav class="mui-bar mui-bar-tab" style="background: #E4E9EA;">
			<a id="indexTab" class="mui-tab-item" href="index.html">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a id="communityTab" class="mui-tab-item" href="community.html">
				<span class="mui-icon mui-icon-pengyouquan"></span>
				<span class="mui-tab-label">社区</span>
			</a>
			<a id="dataTab" class="mui-tab-item" href="data.html">
				<span class="mui-icon mui-icon-contact"></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>
